﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace UDPClient_03
{
    class Program
    {
        static void Main(string[] args)
        {



            UdpClient client = new UdpClient();
            client.Connect(IPAddress.Loopback, 6312);
            while (true)
            {
                try
                {
                    client.Send(new byte[] { }, 0);
                    IPEndPoint remoteEp = null;
                    byte[] data = client.Receive(ref remoteEp);
                    Console.WriteLine(BitConverter.ToString(data));
                    Console.ReadKey(true);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                    Console.ReadKey();
                    break;
                }

            }








        }
    }
}
